package com.zy.qudadid.ui.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.zy.lcpassenger.R;
import com.zy.qudadid.model.Message;
import com.zy.qudadid.presenter.OwnMsgPresenter;
import com.zy.qudadid.ui.adapter.base.BaseAdapter;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by ninos on 2016/7/29.
 */
public class OwnMsgAdapter extends BaseAdapter<OwnMsgAdapter.VHolder, Message, OwnMsgPresenter> {

    public OwnMsgAdapter(Context context, OwnMsgPresenter ownMsgPresenter, View header) {
        super(context, ownMsgPresenter, header);
        isAddFooter = false;
    }

    public OwnMsgAdapter(Context context, OwnMsgPresenter ownMsgPresenter) {
        super(context, ownMsgPresenter);
        isAddFooter = false;
    }

    @Override
    public int provideItemLayoutId() {
        return R.layout.activity_own_msg_item;
    }

    @Override
    public VHolder createVH(ViewGroup parent, int viewType, View view) {
        return new VHolder(view);
    }

    @Override
    public void bindData(VHolder holder, int position) {
        Message message = data.get(position);
        holder.omi_title.setText(message.title);
        holder.omi_content.setText(message.concent);
        holder.txtTime.setText(message.addtime);
    }

    class VHolder extends RecyclerView.ViewHolder {

        @Nullable @Bind(R.id.omi_title)TextView omi_title;
        @Nullable @Bind(R.id.omi_content)TextView omi_content;
        @Nullable @Bind(R.id.txtTime)TextView txtTime;


        VHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }
}
